#include<stdio.h>

void SelectionSort(int *num,int n){
    int i,j;
    int tmp,min;
    for(i = 0;i < n-1;i++){
        min = i;
        for(j = i;j < n;j++) //打擂法找出最小的
            if(num[min]>num[j]) min = j;
        if(min != i){
          tmp = num[min];
          num[min] = num[i];
          num[i] = tmp;
        }
    }
}

int main(){
    int num[] = {5,4,56,23,9,1,3,23,45,2,134,32};
    int len = sizeof(num)/sizeof(int);
    SelectionSort(num,len);

    for(int i = 0;i < len;i++)
        printf("%d ",num[i]);

    return 0;
}

